package com.zst.demo3.service.impl;

import com.zsr.entities.RoleDTO;
import com.zst.demo3.converter.RoleConverter;
import com.zst.demo3.mapper.RoleMapper;
import com.zst.demo3.po.RolePO;
import com.zst.demo3.service.IRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
@Slf4j
public class RoleServiceImpl implements IRoleService {
    @Autowired
    RoleMapper roleMapper;

    @Override
    public Optional<RoleDTO> getRoleById(Long id) {
        RolePO rolePO = roleMapper.selectById(id);
        return Optional.of(RoleConverter.convert2RoleDTO(rolePO));
    }
}
